Mealy Machine
   HOME

TheInfoList



OR:

In the
theory of computation In theoretical computer science and mathematics, the theory of computation is the branch that deals with what problems can be solved on a model of computation, using an algorithm, how efficiently they can be solved or to what degree (e.g., a ...
, a Mealy machine is a
finite-state machine A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
whose output values are determined both by its current
state State may refer to: Arts, entertainment, and media Literature * ''State Magazine'', a monthly magazine published by the U.S. Department of State * ''The State'' (newspaper), a daily newspaper in Columbia, South Carolina, United States * ''Our S ...
and the current inputs. This is in contrast to a
Moore machine In the theory of computation, a Moore machine is a finite-state machine whose current output values are determined only by its current state. This is in contrast to a Mealy machine, whose output values are determined both by its current state and ...
, whose output values are determined solely by its current state. A Mealy machine is a
deterministic Determinism is a philosophical view, where all events are determined completely by previously existing causes. Deterministic theories throughout the history of philosophy have developed from diverse and sometimes overlapping motives and consi ...
finite-state transducer A finite-state transducer (FST) is a finite-state machine with two memory ''tapes'', following the terminology for Turing machines: an input tape and an output tape. This contrasts with an ordinary finite-state automaton, which has a single tape. ...
: for each state and input, at most one transition is possible.


History

The Mealy machine is named after George H. Mealy, who presented the concept in a 1955 paper, "A Method for Synthesizing Sequential Circuits".


Formal definition

A Mealy machine is a 6-tuple (S, S_0, \Sigma, \Lambda, T, G) consisting of the following: * a
finite set In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example, :\ is a finite set with five elements. Th ...
of states S * a start state (also called initial state) S_0 which is an element of S * a
finite set In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example, :\ is a finite set with five elements. Th ...
called the input
alphabet An alphabet is a standardized set of basic written graphemes (called letters) that represent the phonemes of certain spoken languages. Not all writing systems represent language in this way; in a syllabary, each character represents a syll ...
\Sigma * a
finite set In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example, :\ is a finite set with five elements. Th ...
called the output
alphabet An alphabet is a standardized set of basic written graphemes (called letters) that represent the phonemes of certain spoken languages. Not all writing systems represent language in this way; in a syllabary, each character represents a syll ...
\Lambda * a transition
function Function or functionality may refer to: Computing * Function key, a type of key on computer keyboards * Function model, a structured representation of processes in a system * Function object or functor or functionoid, a concept of object-oriente ...
T : S \times \Sigma \rightarrow S mapping pairs of a state and an input symbol to the corresponding next state. * an output function G : S \times \Sigma \rightarrow \Lambda mapping pairs of a state and an input symbol to the corresponding output symbol. In some formulations, the transition and output functions are coalesced into a single function T : S \times \Sigma \rightarrow S \times \Lambda.


Comparison of Mealy machines and Moore machines

# Mealy machines tend to have fewer states: #* Different outputs on arcs (''n''2) rather than states (''n''). # Moore machines are safer to use: #* Outputs change at the clock edge (always one cycle later). #* In Mealy machines, input change can cause output change as soon as logic is done—a big problem when two machines are interconnected – asynchronous feedback may occur if one isn't careful. # Mealy machines react faster to inputs: #* React in the same cycle—they don't need to wait for the clock. #* In Moore machines, more logic may be necessary to decode state into outputs—more gate delays after clock edge.


Diagram

The
state diagram A state diagram is a type of diagram used in computer science and related fields to describe the behavior of systems. State diagrams require that the system described is composed of a finite number of states; sometimes, this is indeed the case, ...
for a Mealy machine associates an output value with each transition edge, in contrast to the state diagram for a Moore machine, which associates an output value with each state. When the input and output alphabet are both , one can also associate to a Mealy automata a Helix
directed graph In mathematics, and more specifically in graph theory, a directed graph (or digraph) is a graph that is made up of a set of vertices connected by directed edges, often called arcs. Definition In formal terms, a directed graph is an ordered pa ...
.Akhavi et al (2012) This graph has as vertices the couples of state and letters, each node is of out-degree one, and the successor of is the next state of the automata and the letter that the automata output when it is instate and it reads letter . This graph is a union of disjoint cycles if the automaton is bireversible.


Examples


Simple

A simple Mealy machine has one input and one output. Each transition edge is labeled with the value of the input (shown in red) and the value of the output (shown in blue). The machine starts in state . (In this example, the output is the
exclusive-or Exclusive or or exclusive disjunction is a logical operation that is true if and only if its arguments differ (one is true, the other is false). It is symbolized by the prefix operator J and by the infix operators XOR ( or ), EOR, EXOR, , , ...
of the two most-recent input values; thus, the machine implements an edge detector, outputting a 1 every time the input flips and a 0 otherwise.)


Complex

More complex Mealy machines can have multiple inputs as well as multiple outputs.


Applications

Mealy machines provide a rudimentary mathematical model for cipher machines. Considering the input and output alphabet the
Latin alphabet The Latin alphabet or Roman alphabet is the collection of letters originally used by the ancient Romans to write the Latin language. Largely unaltered with the exception of extensions (such as diacritics), it used to write English and the o ...
, for example, then a Mealy machine can be designed that given a string of letters (a sequence of inputs) can process it into a ciphered string (a sequence of outputs). However, although a Mealy model could be used to describe the
Enigma Enigma may refer to: *Riddle, someone or something that is mysterious or puzzling Biology *ENIGMA, a class of gene in the LIM domain Computing and technology * Enigma (company), a New York-based data-technology startup * Enigma machine, a family ...
, the state diagram would be too complex to provide feasible means of designing complex ciphering machines. Moore/Mealy machines are DFAs that have also output at any tick of the clock. Modern CPUs, computers, cell phones, digital clocks and basic electronic devices/machines have some kind of finite state machine to control it. Simple software systems, particularly ones that can be represented using
regular expression A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" or ...
s, can be modeled as finite state machines. There are many such simple systems, such as vending machines or basic electronics. By finding the intersection of two finite state machines, one can design in a very simple manner
concurrent system In computer science, concurrency is the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the outcome. This allows for parallel execution of the concurr ...
s that exchange messages for instance. For example, a traffic light is a system that consists of multiple subsystems, such as the different traffic lights, that work concurrently. Some examples of applications: *number classification *watch with timer *vending machine *traffic light *barcode scanner *gas pumps


See also

*
Synchronous circuit In digital electronics, a synchronous circuit is a digital circuit in which the changes in the state of memory elements are synchronized by a clock signal. In a sequential digital logic circuit, data are stored in memory devices called flip-fl ...
*
Moore machine In the theory of computation, a Moore machine is a finite-state machine whose current output values are determined only by its current state. This is in contrast to a Mealy machine, whose output values are determined both by its current state and ...
*
Algorithmic state machine The algorithmic state machine (ASM) method is a method for designing finite state machines (FSMs) originally developed by Thomas E. Osborne at the University of California, Berkeley (UCB) since 1960, introduced to and implemented at Hewlett-Pack ...
*
Richards controller The Richards controller is a method of implementing a finite state machine using simple integrated circuits and combinational logic. The method was named after its inventor, Charles L. Richards. It allows for easier design of complex finite state ...


Footnotes


References

* * * *


External links

*{{Commonscatinline Finite automata Models of computation